home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / private / _getrows.c < prev    next >
C/C++ Source or Header  |  1993-06-20  |  3KB  |  128 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3. #ifdef UNIX
  4. #include <defs.h>
  5. #include <term.h>
  6. #endif
  7.  
  8. #ifdef PDCDEBUG
  9. char *rcsid__getrows = "$Header: C:\CURSES\private\RCS\_getrows.c 2.1 1993/06/18 20:22:53 MH Rel MH $";
  10. #endif
  11.  
  12.  
  13.  
  14.  
  15. /*man-start*********************************************************************
  16.  
  17.   PDC_get_rows()    - Return number of screen rows.
  18.  
  19.   PDCurses Description:
  20.      This is a private PDCurses routine.
  21.  
  22.      Returns the maximum number of rows supported by the display.
  23.      e.g.  25, 28, 43, 50, 60, 66...
  24.  
  25.   PDCurses Return Value:
  26.      This function returns OK on success and ERR on error.
  27.  
  28.   PDCurses Errors:
  29.      No errors are defined for this function.
  30.  
  31.   Portability:
  32.      PDCurses    int PDC_get_rows( void );
  33.  
  34. **man-end**********************************************************************/
  35.  
  36. int    PDC_get_rows(void)
  37. {
  38. #ifdef    DOS
  39.     char *env_rows;
  40.     int        rows;
  41. #endif
  42.  
  43. #ifdef    OS2
  44.     VIOMODEINFO modeInfo;
  45.     int        rows;
  46.     char *env_rows;
  47. #endif
  48.  
  49. #ifdef PDCDEBUG
  50.     if (trace_on) PDC_debug("PDC_get_rows() - called\n");
  51. #endif
  52.  
  53. #ifdef    FLEXOS
  54.         return (vir.vc_size.rs_nrows);
  55. #endif
  56.  
  57. #ifdef    DOS
  58. /* use the value from LINES environment variable, if set. MH 10-Jun-92 */
  59. /* and use the minimum of LINES and *ROWS.                MH 18-Jun-92 */
  60.     rows = getdosmembyte(0x484) + 1;
  61.     env_rows = (char *)getenv("LINES");
  62.     if (env_rows != (char *)NULL)
  63.         rows = min(atoi(env_rows),rows);
  64.  
  65.     if ((rows == 1) && (_cursvar.adapter == _MDS_GENIUS))
  66.         rows = 66;
  67.     if ((rows == 1) && (_cursvar.adapter == _MDA))
  68.         rows = 25;  /* new test MH 10-Jun-92 */
  69.     if (rows == 1)
  70.     {
  71.         rows = _default_lines;    /* Allow pre-setting LINES     */
  72.         _cursvar.direct_video = FALSE;
  73.     }
  74.     switch (_cursvar.adapter)
  75.     {
  76.     case _EGACOLOR:
  77.     case _EGAMONO:
  78.         switch (rows)
  79.         {
  80.         case 25:
  81.         case 43:
  82.             break;
  83.         default:
  84.             rows = 25;
  85.         }
  86.         break;
  87.  
  88.     case _VGACOLOR:
  89.     case _VGAMONO:
  90. /* lets be reasonably flexible with VGAs - they could be Super VGAs */
  91. /* capable of displaying any number of lines. MH 10-Jun-92          */
  92. /*
  93.         switch (rows)
  94.         {
  95.         case 25:
  96.         case 28:
  97.         case 50:
  98.             break;
  99.         default:
  100.             rows = 25;
  101.         }
  102. */
  103.         break;
  104.  
  105.     default:
  106.         rows = 25;
  107.         break;
  108.     }
  109.     return (rows);
  110. #endif
  111.  
  112. #ifdef    OS2
  113. /* use the value from LINES environment variable, if set. MH 10-Jun-92 */
  114. /* and use the minimum of LINES and *ROWS.                MH 18-Jun-92 */
  115.  
  116.     modeInfo.cb = sizeof(modeInfo);
  117.     VioGetMode(&modeInfo, 0);
  118.     rows = modeInfo.row;
  119.     env_rows = (char *)getenv("LINES");
  120.     if (env_rows != (char *)NULL)
  121.         rows = min(atoi(env_rows),rows);
  122.     return(rows);
  123. #endif
  124. #ifdef UNIX
  125.     return(lines);
  126. #endif
  127. }
  128.